// EditJointCommand.cpp: implementation of the EditJointCommand class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "EditJointCommand.h"
#include "SupportHangerSelector.h"
#include "JointSelector.h"
#include "DlgSupport.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

EditJointCommand::EditJointCommand()
{

}

EditJointCommand::~EditJointCommand()
{

}

BOOL EditJointCommand::Execute()
{
	SupportHangerSelector selector;

	SupportHanger* pSH = selector.Select();
	if(pSH == NULL)
	{
		return TRUE;
	}

	JointSelector jointSelector(pSH);
	
	Joint* pJoint = jointSelector.Select();
	if(pJoint == NULL)
		return TRUE;

	CDlgSupport dlg(FALSE);
	dlg.AddJoint(pJoint);
	dlg.DoModal();
	
	EffectProperty(pSH);
	this->ChangeModel(pSH);
	return TRUE;
}